import { RouteRecordRaw } from 'vue-router'

// IOT物联网平台管理系统路由配置
const iotRoutes: RouteRecordRaw[] = [
  {
    path: '/iot',
    component: () => import('@/layout/index.vue'),
    redirect: '/iot/home',
    name: 'IOT',
    meta: {
      title: '物联网平台管理系统',
      icon: 'system',
      alwaysShow: true
    },
    children: [
      // 首页
      {
        path: 'home',
        name: 'IOTHome',
        component: () => import('@/views/IOT/index.vue'),
        meta: {
          title: '首页',
          icon: 'dashboard'
        }
      },
      // 协议管理（一级）
      {
        path: 'protocol',
        name: 'ProtocolManage',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/iot/protocol/protocol-list',
        meta: {
          title: '协议管理',
          icon: 'documentation',
          alwaysShow: true
        },
        children: [
          {
            path: 'category-manage',
            name: 'ProtocolCategory',
            component: () => import('@/views/IOT/protocolManage/categoryManage/index.vue'),
            meta: {
              title: '品类管理',
              icon: 'category'
            }
          },
          {
            path: 'product-manage',
            name: 'ProtocolProduct',
            component: () => import('@/views/IOT/protocolManage/productManage/index.vue'),
            meta: {
              title: '产品管理',
              icon: 'shopping'
            }
          },
          {
            path: 'protocol-list',
            name: 'ProtocolList',
            component: () => import('@/views/IOT/protocolManage/protocolList/index.vue'),
            meta: {
              title: '协议列表',
              icon: 'list'
            }
          },
          {
            path: 'data-format',
            name: 'ProtocolDataFormat',
            component: () => import('@/views/IOT/protocolManage/dataFormatManage/index.vue'),
            hidden: true,
            meta: {
              title: '数据格式',
              icon: 'model'
            }
          },
          {
            path: 'config-attribute',
            name: 'ProtocolConfigAttribute',
            component: () => import('@/views/IOT/protocolManage/configAttributeManage/index.vue'),
            hidden: true,
            meta: {
              title: '配置属性',
              icon: 'tool'
            }
          }
        ]
      },
      // 设备管理（一级）
      {
        path: 'device',
        name: 'DeviceManage',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/iot/device/device-list',
        meta: {
          title: '设备管理',
          icon: 'server',
          alwaysShow: true
        },
        children: [
          {
            path: 'device-list',
            name: 'DeviceList',
            component: () => import('@/views/IOT/deviceManage/deviceList/index.vue'),
            meta: {
              title: '设备列表',
              icon: 'list'
            }
          },
          {
            path: 'camera-manage',
            name: 'CameraManage',
            component: () => import('@/views/IOT/deviceManage/cameraManage/index.vue'),
            meta: {
              title: '摄像机管理',
              icon: 'online'
            }
          }
        ]
      },
      // 接入管理（一级）
      {
        path: 'access',
        name: 'AccessManage',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/iot/access/client-manage',
        meta: {
          title: '接入管理',
          icon: 'link',
          alwaysShow: true
        },
        children: [
          {
            path: 'client-manage',
            name: 'AccessClientManage',
            component: () => import('@/views/IOT/accessManage/clientManage/index.vue'),
            meta: {
              title: '客户端管理',
              icon: 'user'
            }
          }
        ]
      },
      // 规则引擎（一级）
      {
        path: 'rule-engine',
        name: 'RuleEngine',
        component: () => import('@/components/ParentView/index.vue'),
        redirect: '/iot/rule-engine/rule-manage',
        meta: {
          title: '规则引擎',
          icon: 'process-definition',
          alwaysShow: true
        },
        children: [
          {
            path: 'rule-manage',
            name: 'RuleManage',
            component: () => import('@/views/IOT/ruleEngine/ruleManage/index.vue'),
            meta: {
              title: '规则管理',
              icon: 'list'
            }
          }
        ]
      }
    ]
  }
]

export default iotRoutes